package com.FindMyStuff.Model;

import java.util.ArrayList;

public interface IDataAccessor {
	/**
	 * Checks the database for the user with the given email
	 * @param email key to search data source with
	 * @return User the found user or null if user didn't exist
	 */
	public User getUserByEmail(String email);
	
	/**
	 * Updates the status of the user
	 * @param user to update
	 * @param newStatus status to switch the user to. 
	 */
	public void updateUserStatus(User user, UserStatus newStatus);
	
	/**
	 * Creates a user in the database and returns the created user
	 * 
	 * @param email
	 *            primary key of user
	 * @param password
	 *            password for the user
	 * @return User created user
	 */
	public User createUser(String email, String password, UserRole role);
	
	/**
	 * creates a lost item for the currently logged in User
	 * @param name
	 * @param description
	 * @param location
	 * @param category
	 * @param reward 
	 * @return -1 if an error happen creating in the database
	 */
	public Item createItem(String name, String description,
			String location, ItemCategory category, Double reward, ItemType type);
	
	/**
	 * Returns an array of lost items the user has entered into the system
	 * @param user
	 * @param type
	 * @return
	 */
	public ArrayList<Item> getItemsByUser(User user, ItemType type); // old return type Item[]
	
	/**
	 * Removes the user from the system and all the items associated with the user
	 * @param email email of the user to remove
	 * @return 
	 */
	public boolean removeUser(String email);

	/**
	 * Gets every item in the system and returns it as a Database
	 * @return ArrayList of items
	 */
	public ArrayList<Item> getAllItems();

	/**
	 * Returns every item that has the category given with a name like the one provided
	 * @param name of the item
	 * @param cat of the item
	 * @return ArrayList of items
	 */
	public ArrayList<Item> getItemsByName(String name, ItemCategory cat);

	/**
	 * Returns every item for the given User
	 * @param user for the items to search for
	 * @return ArrayList of items
	 */
	public ArrayList<Item> getItemsByUser(User user);

	/**
	 * Returns every item with a name like the one provided
	 * @param name of the item
	 * @return ArrayList of items
	 */
	public ArrayList<Item> getItemsByName(String name);

	/**
	 * Return an Item with a name and location like the one provided
	 * @param name of the item
	 * @param location of the item
	 * @param type ItemType of item
	 * @return matching item
	 */
	Item getItemByNameAndLocation(String name, String location, ItemType type);

}
